import React, {Component} from "react";
import MainItem from "../mainItem";
import PropTypes from "prop-types";

export default class Main extends Component{
    static propTypes={
        mainList:PropTypes.array.isRequired,
        handleDelete:PropTypes.func.isRequired,
        handleUpdate:PropTypes.func.isRequired
    }
    render(){
        const {mainList,handleDelete,handleUpdate}=this.props
        return (
            <ul className="todo-main">
                {mainList.map(mainItem=><MainItem {...mainItem} handleDelete={handleDelete} handleUpdate={handleUpdate} key={mainItem.id}></MainItem>)}
            </ul>
        )
    }

}
